_PATH   = $(patsubst $(monkey_root)/%, %, $(CURDIR))
CC	= @echo "  CC   $(_PATH)/$@"; $CC
CC_QUIET= @echo -n; $CC
CFLAGS	= $CFLAGS
LDFLAGS = $LDFLAGS
DEFS    = $DEFS
INCDIR  = ../../src/include
MANDRIL_OBJECTS = mandril.o

all: monkey-mandril.so

-include $(MANDRIL_OBJECTS:.o=.d)

monkey-mandril.so: $(MANDRIL_OBJECTS)
	$(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -shared -o $@ $^ -lc

.c.o:
	$(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -I$(INCDIR) -fPIC -c $<
	$(CC_QUIET) -MM -MP $(CFLAGS) $(DEFS) $(LDFLAGS) -I$(INCDIR) $*.c -o $*.d > /dev/null &2>&1

clean:
	rm -rf *.[od]
	rm -rf *.*so*
